package com.zyb;

import com.zyb.dao.BookDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        ApplicationContext ctx = new
                ClassPathXmlApplicationContext("applicationContext.xml");
        //方法一
        BookDao bookDao1 = (BookDao) ctx.getBean("bookDao");
        bookDao1.save();

        //方法二
        BookDao bookDao2 =  ctx.getBean("bookDao",BookDao.class);
        bookDao2.save();

        //方法三
        BookDao bookDao3 = ctx.getBean(BookDao.class);
        bookDao3.save();
    }
}
